package pattern.behavioral.mediator.simple;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: chaoyang.ren  
 * @date:Jun 22, 2017  
 * @time:3:03:39 PM   
 * @email:chaoyang.ren@foxmail.com  
 * @version: 1.0
 */
public class QQMediator implements Mediator {
	
	private List<Colleague> colleagues = new ArrayList<Colleague>();

	public void notify(Colleague c) {
		c.talk();
		for (Colleague colleague : colleagues) {
			if(!c.getName().equals(colleague.getName())){
				colleague.talk();
			}
		}
	}

	public void chat(Colleague s1, Colleague s2) {
		s1.talk();
		s2.talk();
	}
	
	public void addColleague(Colleague c){
		colleagues.add(c);
	}

}

